package com.kbbywyclient.ui.activity;
import android.graphics.Color;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.style.ForegroundColorSpan;
import android.view.View;
import android.widget.TextView;

import com.kbbywyclient.R;
import com.kbbywyclient.di.AppComponent;
import com.kbbywyclient.ui.activity.base.BaseActivity;
import com.kbbywyclient.util.ActivitySkipUtil;
import com.kbbywyclient.util.pre.PreUtils;
import com.kbbywyclient.widget.CustomToolBar;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * Created by cbb on 2017/4/17.
 */

public class RechargeSuccessActivity extends BaseActivity {
    @BindView(R.id.v_toolbar)
    CustomToolBar v_toolbar;
    @BindView(R.id.tv_got_score)
    TextView tv_got_score;

    @Override
    protected int provideContentViewId() {
        return R.layout.activity_recharge_success;
    }

    @Override
    protected void onResume() {
        super.onResume();
        setScreenName("充值成功");
    }

    @Override
    protected void initView() {
        v_toolbar.setLeftViewOnClickLinster(v -> finish());
        int chargeAmount=getIntent().getIntExtra("chargeAmount",0);
        String chargeAmountStr=String.valueOf(chargeAmount);
        SpannableString span=new SpannableString("恭喜您获得"+chargeAmount+"积分");
        span.setSpan(new ForegroundColorSpan(Color.parseColor("#FF5301")),
                5,5+chargeAmountStr.length(),
                Spanned.SPAN_EXCLUSIVE_INCLUSIVE);
        tv_got_score.setText(span);
    }

    @Override
    public void initData() {
    }

    @Override
    public void initAppComponent(AppComponent appComponent) {

    }

    @OnClick(R.id.bt_buy_sheet)
    void onClick(View view){
        switch (PreUtils.getBusinessId(this)){
            case 0:
                //贷款
                ActivitySkipUtil.skipAnotherActivity(this, MatchTableActivity.class);
                break;
            case 1:
                //信用卡
                ActivitySkipUtil.skipAnotherActivity(this, CustomerTableActivity.class);
                break;
        }
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
    }
}
